package cn.com.blueInfo.bpm.template.convert;

import cn.com.blueInfo.bpm.common.convert.BaseConvert;
import cn.com.blueInfo.bpm.template.entity.ProcessNode;
import cn.com.blueInfo.bpm.template.request.ProcessNodeDTO;
import cn.com.blueInfo.bpm.template.response.ProcessNodeVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * 模板节点定义表 对象转换
 * @author suxch
 * @since 2025-08-31 16:23:18
 */
@Mapper(componentModel = "spring")
public interface ProcessNodeConvert
        extends BaseConvert<ProcessNode, ProcessNodeDTO, ProcessNodeVO> {

    ProcessNode dtoToEntity(ProcessNodeDTO dto);

    ProcessNode dtoToEntity(ProcessNodeDTO.UpdatePartialDTO dto);

    @Mapping(source = "status", target = "status", qualifiedByName = "enumToDesc")
    @Mapping(source = "deleted", target = "deleted", qualifiedByName = "enumToDesc")
    @Mapping(source = "nodeType", target = "nodeType", qualifiedByName = "enumToDesc")
    @Mapping(source = "draftFlag", target = "draftFlag", qualifiedByName = "enumToDesc")
    ProcessNodeVO entityToVO(ProcessNode entity);

}